package com.module.login.utils;

import com.module.app.bean.UserBean;
import com.module.third.qq.bean.QQUserInfo;
import com.module.third.wx.bean.WxUserInfo;

/**
 * @author bsnl_yanxuwen
 * @date 2021/7/20 11:18
 * Description :
 * 用户信息转换，
 * 如微信用户信息转换，
 * 如QQ用户信息转换
 */
public class UserConvertUtils {
    public static UserBean convertWx(WxUserInfo userInfo) {
        UserBean bean = new UserBean();
        bean.setName(userInfo.getNickname());
        bean.setSex(userInfo.getSex());
        bean.setHeadUrl(userInfo.getHeadimgurl());
        return bean;
    }

    public static UserBean convertQQ(QQUserInfo userInfo) {
        UserBean bean = new UserBean();
        bean.setName(userInfo.getNickname());
        bean.setSex(userInfo.getGenderType() == 1 ? 0 : 1);
        bean.setHeadUrl(userInfo.getFigureurlQq2());
        return bean;
    }
}
